package com.huopaolan.yohuoshop.Mvp.Model;

import com.huopaolan.lib_core.Http.MResponseManager;
import com.huopaolan.lib_core.Mvp.Model.BaseModel;
import com.huopaolan.yohuoshop.Bean.BaseEntity;
import com.huopaolan.yohuoshop.Bean.UserEntity;
import com.huopaolan.yohuoshop.Bean.UserMessageEntity;
import com.huopaolan.yohuoshop.Bean.UserRegisterEntity;
import com.huopaolan.yohuoshop.Mvp.Contract.UserContract;
import com.huopaolan.yohuoshop.NetWork.API;

import java.util.List;

import javax.inject.Inject;

import io.reactivex.Observable;
import okhttp3.MultipartBody;

public class UserModel extends BaseModel implements UserContract.LoginIModel, UserContract.RegisterIModel, UserContract.UserDetailsIModel {
    @Inject
    public UserModel() {
    }

    @Override
    public Observable<UserEntity> login_user(String request) {
        return MResponseManager.obtainRetrofit(API.class).login_user_request(request);
    }

    @Override
    public Observable<UserRegisterEntity> register_user(String request) {
        return MResponseManager.obtainRetrofit(API.class).register_user_request(request);
    }

    @Override
    public Observable<BaseEntity> user_details(String request) {
        return MResponseManager.obtainRetrofit(API.class).update_user_request(request);
    }

    @Override
    public Observable<UserMessageEntity> sel_user(String request) {
        return MResponseManager.obtainRetrofit(API.class).sel_user_request(request);
    }

    @Override
    public Observable<BaseEntity> upload_user(List<MultipartBody.Part> list) {
        return MResponseManager.obtainRetrofit(API.class).upload_head_request(list);
    }

    @Override
    public void destroy() {

    }
}
